More content was added#7
Conversation
| `append` adds an item to the end of a list, `extend` adds | ||
| multiple items from another list and `remove` removes an item. | ||
| multiple items from another list and `remove` removes an item. | ||
| It can also be added with the method of `insert` |
There was a problem hiding this comment.
Do you remember when you used insert last time in a real program? I almost always need append. If people need something else, it's not hard to google "python add item to beginning of list" or whatever actually needs to be done. A mention about googling these things might be good though.
| >>> | ||
| >>> names.insert(len(names), "Aly") | ||
| >>> names | ||
| ['wub_wub', 'RubyPinch', 'Nitori', 'Akuli', 'go|dfish', 'theelous3', 'Aly'] |
| >>> | ||
| ``` | ||
|
|
||
|
|
There was a problem hiding this comment.
Can you add an explanation about how pop is different from remove? Also, I think names.pop(1) is a thing that isn't needed very often in real-world programming (like insert), but popping the last thing with names.pop() is more useful.
| 7 | ||
| ``` | ||
|
|
||
|
|
There was a problem hiding this comment.
The most common way to nest tuples and lists is to have a list of tuples. For example, if you have names and phone numbers, it could be like [('Akuli', '123'), ('luisPinedo', '456')]. Maybe show that?
| 2 x 10 = 20 | ||
| >>> | ||
| ``` | ||
|
|
There was a problem hiding this comment.
Is there an ## Examples section on this page? This could go there. If there isn't, you can create one.
| >>> a **= 2 # a = a ^ 2 | ||
| >>> a | ||
| 121 | ||
| ``` |
There was a problem hiding this comment.
Do we really need this many examples? A couple examples would be good though, maybe with strings because not everyone like numbers and math.
| >>> | ||
| ``` | ||
|
|
||
|
|
There was a problem hiding this comment.
These things are best suited for "Fix this program" exercises IMO. What do you think?
More content was added to variable, lists and tuples, and loops